BUZZER INTERFACING WITH AVR
In this project, we will learn How to interface a DC buzzer with AVR ATmega16 microcontroller. Here, we will make the buzzer to produce sound by giving a required signal to the buzzer circuit.
Synopsis

A buzzer or beeper is an audio signaling device, which maybe mechanical, electromechanical or piezoelectric. Typical uses of buzzers and beepers include alarm devices, timers and confirmation of user input such as a mouse click or keystroke.

In this project, we will learn How to interface a DC buzzer with AVR ATmega16 microcontroller. Here, we will make the buzzer to produce sound by giving a required signal to the buzzer circuit.

Description

ATmega16 belongs to AVR family. Input and Output ports are the way the uC interfaces with other components. Each port contains 8 pins. Ports can be input only output only or bi-directional. The ATmega16 has all bi-directional ports. Bi-directional ports means they have the capability to be both, but you must choose one or the other at any given time. The direction of each pin is set through a special register for each port.

Several ports have dual functionality with the proper register setting they can be used for special operations such as A/D, external interrupts, SPI, etc.

Buzzers are those devices which produce a sound between 1 and 8Khz with vibrating a piezo element or a small speaker with a metal diaphragm. Basically there are two types of Buzzers. One with a bult in oscillator to produce an audible sound, other without the Oscillator.

Piezo Buzzer mainly consists of a multi-vibrator circuit, piezoelectric buzzer films, and the resonance box, shell etc. A multi-vibrator consists of transistors or integrated circuits. When switched on, after (1.5 ~ 15V DC working voltage), multi-harmonic oscillator start-up, output 1.5 ~ 2.5KHZ of audio signals, which results in audible sound. Piezoelectric Buzzer contains zirconate titanate films from lead or lead magnesium niobate piezoelectric ceramic materials. On both sides of the ceramic coating on the silver electrode by polarization and aging treatment, and then with the brass plates or stainless steel sheets stick together.

Electromagnetic Buzzer works from the oscillator, the electromagnetic coil, magnet, diaphragm and shell so on. After power on, the audio oscillator signal current through the electromagnetic coil, so that the electromagnetic coil produces a magnetic field. Diaphragm in the electromagnetic coil and magnet interaction, periodically vibrating voice and thus the audible note. There are too Electromagnetic Buzzers which works without any oscillator. These work by the frequency produced by the make and break contacts to the coil in relation to the moving diaphragm.

Proteus design for Buzzer interfacing with AVR


Orcad design for Buzzer interfacing with AVR


Buzzer interfacing with AVR

/*  Name     : Main.c
 *  Purpose  : Source code for Buzzer Interfacing with ATMEGA16.
 *  Author   : GEMICATES
 *  Date     : 18-07-2017
 *  Website  : www.gemicates.org
 *  Revision : None
 */


#include<avr/io.h>    // Header file
#include<avr/interrupt.h>

int main()
{
 DDRC |= 0X80;        // PC7 configured as output       
 DDRD &= 0XFC;        // PD2 PD3 configured as input     
 SREG  = 0X80;        // Global Interrupt Enable         
 MCUCR = 0X0F;        // Rising edge generates interrupt 
 GICR  = 0XC0;        // INT0 INT1 activated             
 while(1);
}


ISR(_VECTOR(1))       // External Interrupt Request 0   
{
 GIFR   = 0XC0;       // Interrupt Flag Clear           
 PORTC ^= (0x80);
}

Error message here!

Show Error message here!


Forgot your password?

Error message here!

Send OTP

Error message here!

Show Error message here!


Lost your password? Please enter your email address. You will receive a password you Need.

Send Error message here!


Back to log-in

Close